package pacBioSimple;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Enumeration;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import pacBiopackage.GetOpt;
import tools.hmmer.test;

public class ReadingZipTest {

	public static void main(String[] args) 
	{
		GetOpt go = new GetOpt(args, "o:a:");
		go.optErr = true;
		int ch = -1;
		
		// process options in command line arguments
		// Set default values
		boolean usagePrint = false;                 
		String fileInput = "";   
		String filenameOutput="output.txt";
		while ((ch = go.getopt()) != GetOpt.optEOF) 
		{
		    if ((char)ch == 'h') {
		       usagePrint = true;
		   }
		    else if ((char)ch == 'a') {
		    	fileInput = go.optArgGet();
		    }
		    else if((char)ch =='o')
		    {
		    	filenameOutput = go.optArgGet();
		    }
		    else
		        System.exit(1);                     // undefined option
		}                                           // getopt() returns '?'
		
		if (usagePrint || fileInput.isEmpty()) {
		    System.out.println("Usage: -a zipData [ -o outputFile -h]"); //NOI18N
		    System.exit(0);
		}
		
		// @TODO check if files exist
	
		System.out.println("------------------------");
		System.out.println("Command line parameter settings:");
		System.out.println("-a " + fileInput); //NOI18N
		System.out.println("------------------------");

		try
		{
//			InputStream fileStream = new FileInputStream(fileInput);
//			InputStream gzipStream = new GZIPInputStream(fileStream);
//			BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(gzipStream));
			
			
			BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(fileInput))));
			
			
			System.out.println(bufferedReader.readLine());
			System.out.println(bufferedReader.readLine());
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
	
	
}
